const mongoose = require("mongoose")

const { Schema } = mongoose

const schema = new Schema({
    name: { type: String },
    title: { type: String },
    avatar: { type: String },
    banner: { type: String },
    categories: [{
        type: Schema.Types.ObjectId,
        ref: "Category"
    }],
    scores: {
        difficult: { type: Number },
        skills: { type: Number },
        attack: { type: Number },
        survive: { type: Number }
    },
    items1: [{
        type: Schema.Types.ObjectId,
        ref: "Item"
    }],
    items2: [{
        type: Schema.Types.ObjectId,
        ref: "Item"
    }],
    usageTips: { type: String },
    battleTips: { type: String },
    teamTips: { type: String },
    skills: [{
        name: { type: String },
        icon: { type: String },
        cost: { type: String },
        delay: { type: String },
        description: { type: String },
        tips: { type: String }
    }],
    partners: [{
        hero: {
            type: Schema.Types.ObjectId,
            ref: "Hero",
            // refPath: "partners.hero"
        },
        description: { type: String }
    }]
})

module.exports = mongoose.model("Hero", schema, "heroes")